<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
	<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> 
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>帖子信息展示</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="fly,layui,前端社区">
  <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
  <link rel="stylesheet" href="/bzbs/replypost/res/layui/css/layui.css">
  <link rel="stylesheet" href="/bzbs/replypost/res/css/global.css">
</head>
<body>



<div class="layui-hide-xs">
  <div class="fly-panel fly-column">
    <div class="layui-container">
     <!--  <ul class="layui-clear">
        <li class="layui-hide-xs"><a href="/">首页</a></li> 
        <li class="layui-this"><a href="">提问</a></li> 
        <li><a href="">分享<span class="layui-badge-dot"></span></a></li> 
        <li><a href="">讨论</a></li> 
        <li><a href="">建议</a></li> 
        <li><a href="">公告</a></li> 
        <li><a href="">动态</a></li> 
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li> 
        
        用户登入后显示
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="../user/index.html">我发表的贴</a></li> 
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="../user/index.html#collection">我收藏的贴</a></li> 
      </ul>  -->
      
      <div class="fly-column-right layui-hide-xs"> 
        <a href="<%=path%>/replypost/add.jsp" class="layui-btn">发表新帖</a> 
      </div> 
      <div class="layui-hide-sm layui-show-xs-block" style="margin-top: -10px; padding-bottom: 10px; text-align: center;"> 
        <a href="add.html" class="layui-btn">发表新帖</a> 
      </div> 
    </div>
  </div>
</div>

<div class="layui-container">

 <input type="hidden" id="personId" value="${sessionScope.user.id}">


  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8 content detail">
      <div class="fly-panel detail-box">
        <h1>${requestScope.post.title}</h1>
        <div class="fly-detail-info">
          <!-- <span class="layui-badge">审核中</span> -->
          <span class="layui-badge layui-bg-green fly-detail-column">${requestScope.post.type}</span>
                                 <span class="fly-link"> ${requestScope.post.student.stuName}</span>
                     
                      <span style="color:#999999">${requestScope.post.createTime}</span>
          
          <span class="fly-list-nums"> 
            <a href="#comment"><i class="iconfont" title="回答">&#xe60c;</i> ${requestScope.post.replyNum}</a>
            <i class="iconfont" title="人气">&#xe60b;</i>${requestScope.post.view}
          </span>
        </div>
        <div class="detail-body">
			${requestScope.post.content}
        </div>
      </div>

      <div class="fly-panel detail-box" id="flyReply">
        <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
          <legend>回帖</legend>
        </fieldset>

        <ul class="jieda" id="jieda">

          <c:forEach items="${requestScope.replyList}" var="reply">
          
          
          <li data-id="111">
            <a name="item-1111111111"></a>
            <div class="detail-about detail-about-reply">
              <div class="fly-detail-user" style="position:absolute;left:0px;top:2px">
                <a href="" class="fly-link">
                  <cite>${reply.student.stuName}</cite>       
                </a>
                
              <%--  <c:if test="${reply.replierId==requestScope.post.authorId">       
                	<span>(楼主)</span>
				</c:if> --%>
              </div>
              <div class="detail-hits">
                <span>${reply.replyTime}</span>
              </div>
            </div>
            <div class="detail-body jieda-body photos">
					${reply.content}

            </div>
            


            <div class="jieda-reply">
              <span class="jieda-zan"   id="${reply.replyId}" data-id="${reply.replyId}"  >
                <i class="iconfont icon-zan" ></i>
                <em >${reply.likes}</em>
              </span>
              <span type="reply">
                <i class="iconfont icon-svgmoban53"></i>
                		回复
              </span>
              <div class="jieda-admin">
               <%--   <c:if test="${reply.student.id==sessionScope.user.id}">       
                <span type="del">删除</span>
				</c:if> --%>
				
              </div>
            </div>
          </li>
          </c:forEach>
          
          
          <c:if test="${empty   requestScope.replyList}">       
          	<li class="fly-none">消灭零回复</li>
		</c:if>
        </ul>
        
        <div class="layui-form layui-form-pane">
          <form action="../reply/add.do" method="post">
                      <input type="hidden" name="postId" value="${requestScope.post.postId}">
          
            <div class="layui-form-item layui-form-text">
              <a name="comment"></a>
              <div class="layui-input-block">
                <textarea id="L_content" name="content" required lay-verify="required" placeholder="请输入内容"  class="layui-textarea fly-editor" style="height: 150px;"></textarea>
              </div>
            </div>
            <div class="layui-form-item">
              <input type="hidden" name="jid" value="123">
              <button class="layui-btn" type="submit">提交回复</button>
            </div>
          </form>
        </div>
      </div>
    </div>
    <div class="layui-col-md4">
      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title" style="color:red">本周热议</dt>
        <c:forEach items="${requestScope.hotPostList}" var="hotPost">
      	
        <dd>
          <a href="../post/queryDetail.do?postId=${hotPost.postId}" class="fly-link">${hotPost.title}</a>
          <span><i class="iconfont icon-pinglun1"></i> ${hotPost.replyNum}</span>
        </dd>
        </c:forEach>
        
		<c:if test=" ${ empty requestScope.hotPostList}">       
			 <div class="fly-none">没有相关数据</div>
		</c:if>

      </dl>

      <div class="fly-panel">
        <div class="fly-panel-title">
          这里可作为广告区域
        </div>
        <div class="fly-panel-main">
          <a href="#" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">李家利是大帅哥</a>
        </div>
      </div>

      <div class="fly-panel" style="padding: 20px 0; text-align: center;">
        <img src="/bzbs/replypost/res/images/weixin.jpg" style="max-width: 100%;" alt="layui">
        <p style="position: relative; color: #666;">微信扫码添加 handsome coding boy</p>
      </div>

    </div>
  </div>
</div>


<script src="/bzbs/replypost/res/layui/layui.js"></script>
<script src="/bzbs/replypost/res/layui/jquery-1.9.1.js"></script>
<script>
layui.cache.page = 'jie';
layui.cache.user = {
  username: '游客'
  ,uid: -1
  ,avatar: '../../res/images/avatar/00.jpg'
  ,experience: 83
  ,sex: '男'
};
layui.config({
  version: "3.0.0"
  ,base: '/bzbs/replypost/res/mods/'
}).extend({
  fly: 'index'
}).use(['fly', 'face'], function(){
  var $ = layui.$
  ,fly = layui.fly;
  //如果你是采用模版自带的编辑器，你需要开启以下语句来解析。
  
  $('.detail-body').each(function(){
    var othis = $(this), html = othis.html();
    othis.html(fly.content(html));
  });
  
});

//ajax实现点赞功能  Asychronous Javascript And XML
	$(document).on("click",".jieda-zan",function(){
	var replyId=$(this).attr("data-id");
	var personId=$("#personId").val();
	$.ajax({
		   type: "POST",
		   url: "../reply/great.do",
		   data: "replyId="+replyId+"&personId="+personId+"",
		   success: function(msg){
		    var array=msg.split("-");
		   	//假如已经点赞则为红色
		   	if(array[0]==true){
		   	 $("#"+replyId+"").html("<i class='iconfont icon-zan' ></i><em>"+array[1]+"</em>");
		   		$("#"+replyId+"").css("color","red");
		   	}else{
			 $("#"+replyId+"").html("<i class='iconfont icon-zan' ></i><em>"+array[1]+"</em>");
		   	} 
		   }
		});
	
	});
</script>

</body>
</html>